package com.xone.xapp;

import org.json.JSONArray;
import org.json.JSONObject;

public class ProductListUserHolder extends BasicListHolder {
	protected String id;
	protected String productName;
	protected String dateCreated;
	protected String productTypeName;
	protected String productLocation;
	protected String productDesc;
	protected String checkStatus;
	protected String statusName;
	protected String [] ids;
	public ProductListUserHolder(JSONObject jSONObject) {
		id = JSONUtils.getStringFromJSONObject(jSONObject, "id");
		productName = JSONUtils.getStringFromJSONObject(jSONObject, "productName");
		dateCreated = JSONUtils.getStringFromJSONObject(jSONObject, "dateCreated");
		if (null != dateCreated) {
			dateCreated = dateCreated.replaceFirst("T", " ");
		}
		checkStatus = JSONUtils.getStringFromJSONObject(jSONObject, "checkStatus");
		statusName = JSONUtils.getStringFromJSONObject(jSONObject, "checkStatusName");
		productTypeName = JSONUtils.getStringFromJSONObject(jSONObject, "productTypeName");
		productLocation = JSONUtils.getStringFromJSONObject(jSONObject, "productLocation");
		productDesc = JSONUtils.getStringFromJSONObject(jSONObject, "productDesc");
		JSONArray jids = JSONUtils.getJSONArrayForKey(jSONObject, "ids");
		if (null != jids && jids.length() > 0) {
			ids = new String [jids.length()];
			for (int i = 0; i < jids.length(); i++) {
				ids[i] = JSONUtils.getStringFromJSONArray(jids, i);
			}
		}
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getProductName() {
		return productName;
	}
	public void setProductName(String productName) {
		this.productName = productName;
	}
	public void setDateCreated(String dateCreated) {
		this.dateCreated = dateCreated;
	}
	public String getProductTypeName() {
		return productTypeName;
	}
	public void setProductTypeName(String productTypeName) {
		this.productTypeName = productTypeName;
	}
	public String getProductLocation() {
		return productLocation;
	}
	public void setProductLocation(String productLocation) {
		this.productLocation = productLocation;
	}
	public String getProductDesc() {
		return productDesc;
	}
	public void setProductDesc(String productDesc) {
		this.productDesc = productDesc;
	}
	public String[] getIds() {
		return ids;
	}
	public void setIds(String[] ids) {
		this.ids = ids;
	}
	public String getCheckStatus() {
		return checkStatus;
	}
	public void setCheckStatus(String checkStatus) {
		this.checkStatus = checkStatus;
	}
	public String getStatusName() {
		return statusName;
	}
	public void setStatusName(String statusName) {
		this.statusName = statusName;
	}
	@Override
	public String getDateCreated() {
		return dateCreated;
	}
	@Override
	public String getDataCreatedName() {
		return "product.dateCreated";
	}

}
